package sdiff.tests;

import smallChanges.lineNumberMapping.StatementMapper;
import smallChanges.statements.StatementMappingEntry;
import smallChanges.statements.StatementMappingResultSet;
import junit.framework.TestCase;

public class SampleTests extends TestCase
{
    public void testOne()
    throws Exception
    {
        // This JUnit test demonstrates how to use the 
        // programmatic interface for SDiff.  Once you have
        // a StatementMappingResultSet, you can iterate through
        // it and process the matches further.  This code simply
        // prints out the mappings.
        
        // Default constructor uses the default settings.
        StatementMapper mapper=new StatementMapper();
        
        String version="1.4";
        
        mapper.setSourceFiles("files/test-data/Example_1.java", version,
                "files/test-data/Example_2.java", version);
        
        // Run the mapper and produce the line matchings
        StatementMappingResultSet results=mapper.run();
        
        // Print out the matchings
        for (StatementMappingEntry e : results) {
            System.out.println(e);
        }
    }
    
    public void testTwo()
    throws Exception
    {
        // Default constructor uses the default settings.
        StatementMapper mapper=new StatementMapper();
        
        String version="1.4";
        
        mapper.setSourceFiles("files/test-data/Example_1.java", version,
                "files/test-data/Example_4.java", version);
        
        // Run the mapper and produce the line matchings
        StatementMappingResultSet results=mapper.run();
        
        // Print out the matchings
        for (StatementMappingEntry e : results) {
            // You can do things with the mapping entry e
            // other than just print it.
            System.out.println(e);
        }
    }
}
